<template>
	<view class="commodity" :style="'flex-wrap:'+wrap+';'">
		<view class="commodity-item" v-for="item in dataList" :key="item.id" :style="'width:'+ itemW +';'">
			<view class="commodity-img" :style="'height:'+ bigH +';'">
				图片
			</view>
			<view class="commodity-content">
				<text class="commodity-name">{{item.name}}</text>
				<view>
					<text class="pprice">￥{{item.pproce}}</text>
					<text class="oprice">￥{{item.oprice}}</text>
				</view>
				<text class="discount">{{item.discount}}折</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			dataList: Array,

			itemW: {
				type: String,
				default: '375rpx'
			},
			bigH:{
				type: String,
				default: '375rpx'
			},
			wrap:{
				type:String,
				default:'wrap'
			}
		}
	}
</script>

<style scoped>
	.commodity {
		display: flex;
		/* flex-wrap: wrap; */
		justify-content: space-between;
	}

	.commodity-item {
		width: 48%;
		background: #999;
		/* width: 375rpx; */
		padding-bottom: 20rpx;
	}

	.commodity-img {
		width: 100%;
		/* height: 375rpx; */
		background-color: pink;
	}

	.commodity-content {
		text-align: center;

	}

	.commodity-name {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		color: #333;
		word-break: break-all;
		padding: 6rpx 20rpx;
	}

	.pprice {
		text-decoration: line-through;
		font-size: 24rpx;
		color: #333;
	}

	.oprice {
		font-size: 24rpx;
		color: darkred;
	}

	.discount {
		border-radius: 4rpx;
		border: 1rpx solid red;
		padding: 2rpx 10rpx;
		color: red;
		font-size: 20rpx;
	}
</style>